/**
    package: learn-go
    filename: main
    author: diogo@gmail.com
    time: 2022/9/19 16:44
**/
package main

import (
	"fmt"
	"time"
)

func main() {

	ch := make(chan interface{}, 1)

	go queryBaidu(ch)

	go queryYoudao(ch)

	fmt.Println(<-ch)


	fmt.Println("channel 16")
}



func queryBaidu(result chan interface{}) error{

	defer close(result)

	time.Sleep(3*time.Second)

	result <- "diogoxiang  baidu"

	return nil
}

func queryYoudao(result chan interface{}) error {
	defer close(result)

	time.Sleep(2*time.Second)

	result <- "diogoxiang  Youdao"


	return nil
}